var units = years; var davidAge = 65; var johnAge = 40; var ageDifference = davidAge - johnAge; alert(The age difference is + ageDifference + + units);

44

The code is more readable with an appropriately named variable, 
rather than including an arithmetic expression 
inside of parentheses inside of a concatenation.

Comments

Submit
0 Comments